package com.mediator;

// 具体的同事类
public class Alarm extends Colleague{

    // 构造器
    public Alarm(Mediator mediator, String ColleagueName) {
        super(mediator, ColleagueName);
        // 在创建Alarm同事对象时，将自己放入到ConcreteMediator 对象中[集合]
        mediator.Register(ColleagueName, this);
    }

    public void SendAlarm(int stateChange){
        SendMessage(stateChange);
    }

    @Override
    public void SendMessage(int stateChange) {
        // 调用中介者对象的getMessage
        this.getMediator().getMessage(stateChange, this.ColleagueName);
    }
}
